home *** CD-ROM | disk | FTP | other *** search
- // Dynamic link library implementation of NeuroSolutions BackIntegratorAxon component
-
- #include "NSDLL.h"
-
- /********************************/
- /* Backpropagation of component */
-
- __declspec(dllexport) void performBackContextAxon(
- DLLData *instance, // Pointer to instance data (may be NULL)
- DLLData *dualInstance, // Pointer to the forward axons instance data (may be NULL)
- NSFloat *error, // Pointer to the current error vector
- int rows, // Number of rows of PEs in the layer
- int cols, // Number of columns of PEs in the layer
- NSFloat *delayedError, // Pointer to the last error vector (delayed by one time step)
- NSFloat *data, // Pointer to the layer of processing elements (PEs)
- NSFloat *tau, // Pointer to a vector of time constants, one for each PE
- NSFloat beta, // Linear scaling factor controlled within the components inspector
- NSFloat *gradient // Pointer to the tau gradient vector
- )
-
- {
- int i, length=rows*cols;
-
- for (i=0; i<length; i++) {
- error[i] = beta*((1.0f-tau[i])*data[i] + tau[i]*delayedError[i]);
- if (gradient)
- gradient[i] += delayedError[i]*beta*data[i];
- }
- }
-
- /******************************************/
- /* Management of instance data (OPTIONAL) */
- /*
- __declspec(dllexport) DLLData *allocBackContextAxon(
- DLLData *oldInstance, // Pointer to the last instance if reallocating
- DLLData *dualInstance, // Pointer to forward axonÆs instance data (may be NULL)
- int rows, // Number of rows of PEs in the layer
- int cols // Number of columns of PEs in the layer
- )
- {
- DLLData *instance = allocDLLInstance(oldInstance);
- return instance;
- }
-
- __declspec(dllexport) void freeBackContextAxon(DLLData *instance)
- {
- freeDLLInstance(instance);
- }
- */